<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <h3>模板语法</h3>
      <!-- v-once指令表示这个元素只会被渲染一次 -->
      <p v-once>{{ count }}</p>
      <p>{{ count }}</p>
      <button @click="count++">btn</button>

      <hr />

      <!-- v-html指令可以将内容转成html标签进行渲染 -->
      <div>{{ content }}</div>
      <div v-html="content"></div>
      <!-- v-text指令和双大括号一样渲染普通文本 -->
      <div v-text="content"></div>

      <hr />

      <img :[str]="imgUrl" alt="" />
    </div>

    <script src="../../Vue.js"></script>
    <script>
      new Vue({
        el: "#app",
        data: {
          count: 1,
          content: "<h1>标题</h1>",
          str: "data-src",
          imgUrl:
            "https://img2.baidu.com/it/u=839977396,1548112407&fm=253&fmt=auto&app=138&f=JPEG?w=554&h=500",
        },
        mounted() {
          setTimeout(() => {
            this.str = "src";
          }, 2000);
        },
      });
    </script>
  </body>
</html>
